home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / Sound.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  11.7 KB  |  408 lines  |  [TEXT/MPS ]

  1. ; Version: 3.24
  2. ; Created: Friday, October 20, 1989 at 9:54:13 PM
  3. ;
  4. ; File: Sound.a
  5. ;
  6. ; Assembler Interface to the Macintosh Libraries
  7. ; Copyright Apple Computer, Inc. 1986-1991
  8. ; All Rights Reserved
  9. ;
  10. ;--------------------------------------------------------------------
  11.  
  12.     IF &TYPE('__IncludingSound__') = 'UNDEFINED' THEN
  13. __IncludingSound__    SET    1
  14.  
  15.  
  16. ; _______________________________________________________________________
  17. ; Sound Driver
  18. ; _______________________________________________________________________
  19.  
  20. swMode             EQU -1
  21. ftMode             EQU 1
  22. ffMode             EQU 0
  23.  
  24. FFSynthRec        RECORD 0
  25. mode            DS.W 1
  26. count            DS.L 1
  27. waveBytes        DS.B 30001
  28.                 ENDR
  29.  
  30. Tone            RECORD 0
  31. count            DS.W 1
  32. amplitude        DS.W 1
  33. duration        DS.W 1
  34. toneRecSize        EQU *
  35.                 ENDR
  36.  
  37. SWSynthRec        RECORD 0
  38. mode            DS.W 1
  39. triplets        DS.B 5001*Tone.toneRecSize
  40.                 ENDR
  41.  
  42. FTSoundRec        RECORD 0
  43. duration        DS.W 1
  44. sound1Rate        DS.L 1
  45. sound1Phase        DS.L 1
  46. sound2Rate        DS.L 1
  47. sound2Phase        DS.L 1
  48. sound3Rate        DS.L 1
  49. sound3Phase        DS.L 1
  50. sound4Rate        DS.L 1
  51. sound4Phase        DS.L 1
  52. sound1Wave        DS.L 1
  53. sound2Wave        DS.L 1
  54. sound3Wave        DS.L 1
  55. sound4Wave        DS.L 1
  56.                 ENDR
  57.  
  58. FTSynthRec        RECORD 0
  59. mode            DS.W 1
  60. sndRec            DS.L 1
  61.                 ENDR
  62. ; _______________________________________________________________________
  63. ; Sound Manager constants
  64. ; _______________________________________________________________________
  65.  
  66. synthCodeRsrc             EQU 'snth'
  67. soundListRsrc             EQU 'snd '
  68.  
  69. rate22khz                EQU $56EE8BA3        ; 22254.54545
  70. rate11khz                EQU $2B7745D1        ; 11127.27273
  71.  
  72. ; synthesizer numbers for SndNewChannel
  73.  
  74. squareWaveSynth         EQU 1            ; square wave synthesizer
  75. waveTableSynth             EQU 3             ; wave table synthesizer
  76. sampledSynth             EQU 5            ; sampled sound synthesizer
  77.  
  78. ; Command Numbers
  79.  
  80. nullCmd                 EQU 0
  81. initCmd                 EQU 1
  82. freeCmd                 EQU 2
  83. quietCmd                 EQU 3
  84. flushCmd                 EQU 4
  85. reInitCmd                 EQU 5
  86.  
  87. waitCmd                 EQU 10
  88. pauseCmd                 EQU 11
  89. resumeCmd                 EQU 12
  90. callBackCmd             EQU 13
  91. syncCmd                 EQU 14
  92. emptyCmd                 EQU 15
  93.  
  94. tickleCmd                 EQU 20
  95. requestNextCmd             EQU 21
  96. howOftenCmd             EQU 22
  97. wakeUpCmd                 EQU 23
  98. availableCmd             EQU 24
  99. versionCmd                 EQU 25
  100. totalLoadCmd             EQU 26
  101. loadCmd                 EQU 27
  102.  
  103. scaleCmd                 EQU 30
  104. tempoCmd                 EQU 31
  105.  
  106. freqDurationCmd         EQU 40
  107. restCmd                 EQU 41
  108. freqCmd                 EQU 42
  109. ampCmd                     EQU 43
  110. timbreCmd                 EQU 44
  111. getAmpCmd                EQU 45
  112. waveTableCmd             EQU 60
  113. phaseCmd                 EQU 61
  114.  
  115. soundCmd                 EQU 80
  116. bufferCmd                 EQU 81
  117. rateCmd                 EQU 82
  118. continueCmd             EQU 83
  119. doubleBufferCmd         EQU 84
  120. getRateCmd                 EQU 85
  121.  
  122. sizeCmd                 EQU 90
  123. convertCmd                 EQU 91
  124.  
  125. stdQLength                 EQU 128
  126. dataOffsetFlag             EQU $8000
  127.  
  128. waveInitChannelMask        EQU $07
  129. waveInitChannel0        EQU $04
  130. waveInitChannel1        EQU $05
  131. waveInitChannel2        EQU $06
  132. waveInitChannel3        EQU $07
  133.  
  134. ; channel initialization parameters
  135.  
  136. initPanMask                EQU $0003        ; mask for right/left pan values
  137. initSRateMask             EQU $0030        ; mask for sample rate values
  138. initStereoMask             EQU $00C0        ; mask for mono/stereo values
  139. initCompMask            EQU $FF00        ; mask for compression IDs
  140.  
  141. initChanLeft             EQU $0002        ; left stereo channel
  142. initChanRight             EQU $0003        ; right stereo channel
  143. initSRate22k             EQU $0020        ; 22k sampling rate
  144. initMono                 EQU $0080        ; monophonic channel
  145. initStereo                 EQU $00C0        ; stereo channel
  146. initNoInterp             EQU $0004        ; no linear interpolation
  147. initNoDrop                EQU $0008        ; no drop-sample conversion
  148. initMACE3                 EQU $0300        ; MACE 3:1
  149. initMACE6                 EQU $0400        ; MACE 6:1
  150.  
  151. initChan0                 EQU $0004        ; channel 0 - wave table only
  152. initChan1                 EQU $0005        ; channel 1 - wave table only
  153. initChan2                 EQU $0006        ; channel 2 - wave table only
  154. initChan3                 EQU $0007        ; channel 3 - wave table only
  155.  
  156. stdSH                     EQU $0
  157. extSH                     EQU $FF
  158. cmpSH                     EQU $FE
  159.  
  160. notCompressed             EQU 0
  161. twoToOne                 EQU 1
  162. eightToThree             EQU 2
  163. threeToOne                 EQU 3
  164. sixToOne                 EQU 4
  165.  
  166. outsideCmpSH             EQU 0
  167. insideCmpSH             EQU 1
  168. aceSuccess                 EQU 0
  169. aceMemFull                 EQU 1
  170. aceNilBlock             EQU 2
  171. aceBadComp                 EQU 3
  172. aceBadEncode             EQU 4
  173. aceBadDest                 EQU 5
  174. aceBadCmd                 EQU 6
  175. sixToOnePacketSize         EQU 8
  176. threeToOnePacketSize     EQU 16
  177. stateBlockSize             EQU 64
  178. leftOverBlockSize         EQU 32
  179.  
  180. firstSoundFormat         EQU 1
  181. secondSoundFormat         EQU 2
  182.  
  183. dbBufferReady             EQU $00000001
  184. dbLastBuffer             EQU $00000004
  185.  
  186. sysBeepDisable            EQU $0000
  187. sysBeepEnable            EQU $0001
  188.  
  189. unitTypeNoSelection        EQU $FFFF
  190. unitTypeSeconds            EQU $0000
  191.  
  192.  
  193. noneCompType            EQU 'NONE'        ; use no compression on samples
  194. MACE3CompType            EQU 'MAC3'        ; use MACE 3:1 compression on samples
  195. MACE6CompType            EQU 'MAC6'        ; use MACE 6:1 compression on samples
  196.  
  197.  
  198. ; _______________________________________________________________________
  199. ; Sound Manager structures
  200. ; _______________________________________________________________________
  201.  
  202. SndCommand            RECORD 0
  203. cmd                   DS.W 1             ; INTEGER
  204. param1                DS.W 1             ; INTEGER
  205. param2                DS.L 1             ; LONGINT
  206. sndCSize              EQU *             ; size of SndCommand
  207.                       ENDR
  208.  
  209. SndChannel            RECORD 0
  210. nextChan              DS.L 1             ; ^SndChannel
  211. firstMod              DS.L 1             ; Ptr
  212. callBack              DS.L 1             ; ProcPtr
  213. userInfo              DS.L 1
  214.  
  215. ; The following is for internal Sound Manager use only.
  216.  
  217. wait                  DS.L 1             ; Time [LONGINT]
  218. cmdInProgress         DS SndCommand 
  219. flags                 DS.W 1             ; INTEGER
  220. qLength               DS.W 1             ; INTEGER
  221. qHead                 DS.W 1             ; INTEGER
  222. qTail                 DS.W 1             ; INTEGER
  223. queue                 DS.B stdQLength*SndCommand.sndCSize
  224. sndChSize             EQU *             ; size of SndChannel
  225.                       ENDR
  226.  
  227. SoundHeader           RECORD 0
  228. samplePtr             DS.L 1             ; Ptr - if NIL then samples are in sampleArea
  229. length                DS.L 1             ; LONGINT
  230. sampleRate            DS.L 1             ; Fixed
  231. loopStart             DS.L 1             ; LONGINT
  232. loopEnd               DS.L 1             ; LONGINT
  233. baseFrequency          DS.W 1             ; INTEGER
  234. sampleArea            EQU     *             ; PACKED ARRAY [0..0] OF Byte
  235.                       ENDR
  236.  
  237. SMStatus            RECORD 0
  238. smMaxCPULoad        DS.W 1
  239. smNumChannels        DS.W 1
  240. smCurCPULoad        DS.W 1
  241.                     ENDR
  242.  
  243. SCStatus            RECORD 0
  244. scStartTime            DS.L 1
  245. scEndTime            DS.L 1
  246. scCurrentTime        DS.L 1
  247. scChannelBusy        DS.B 1
  248. scChannelDisposed    DS.B 1
  249. scChannelPaused        DS.B 1
  250. scUnused            DS.B 1
  251. scChannelAttributes    DS.L 1
  252. scCPULoad            DS.L 1
  253.                     ENDR
  254.  
  255. AudioSelection        RECORD 0
  256. unitType            DS.L 1
  257. selStart            DS.L 1        ; Fixed; 
  258. selEnd                DS.L 1        ; Fixed; 
  259.                     ENDR
  260.  
  261. SndDoubleBuffer        RECORD 0
  262. dbNumFrames            DS.L 1
  263. dbFlags                DS.L 1
  264. dbUserInfo            DS.L 2
  265. dbSoundData            EQU *                        
  266.                     ENDR
  267.  
  268. SndDoubleBufferHeader    RECORD 0
  269. dbhNumChannels            DS.W 1
  270. dbhSampleSize            DS.W 1
  271. dbhCompressionID        DS.W 1
  272. dbhPacketSize            DS.W 1
  273. dbhSampleRate            DS.L 1
  274. dbhBufferPtr            DS.L 2
  275. dbhDoubleBack            DS.L 1
  276. SndDoubleBufferHeaderSz    EQU  *                        
  277.                         ENDR
  278.  
  279. ; _______________________________________________________________________
  280. ; MACE structures
  281. ; _______________________________________________________________________
  282.  
  283.  
  284. LeftOverBlock        RECORD 0
  285. count                DS.L 1
  286. sampleArea            DS.B leftOverBlockSize
  287.                     ENDR
  288.  
  289. CmpSoundHeader         RECORD 0
  290. samplePtr            DS.L 1            ; if NIL then samples are in sampleArea
  291. numChannels            DS.L 1            ; number of channels  mono = 1
  292. sampleRate            DS.L 1            ; sample rate in Apples Fixed point representation
  293. loopStart            DS.L 1            ; loopStart of sound before compression
  294. loopEnd                DS.L 1            ; loopEnd of sound before compression
  295. encode                DS.B 1            ; data structure used ,  stdSH, extSH, or cmpSH
  296. baseFrequency        DS.B 1            ; same meaning as regular SoundHeader
  297. numFrames            DS.L 1            ; length in frames    ( packetFrames or sampleFrames
  298. AIFFSampleRate        DS.B 10            ; IEEE sample rate EXTENDED number
  299. markerChunk            DS.L 1            ; sync track
  300. futureUse1            DS.L 1            ; reserved by Apple
  301. futureUse2            DS.L 1            ; reserved by Apple
  302. stateVars            DS.L 1            ; pointer to State Block
  303. leftOverSamples        DS.L 1            ; used to save truncated samples between compression calls
  304. compressionID        DS.W 1            ; 0 means no compression, non zero means compressionID
  305. packetSize            DS.W 1            ; number of bits in compressed sample packet
  306. snthID                DS.W 1            ; Resource ID of Sound Manager snth that contains NRT C/E
  307. sampleSize            DS.W 1            ; number of bits in non-compressed sample
  308. sampleArea            EQU     *            ; space for when samples follow directly
  309.                     ENDR
  310.  
  311. ExtSoundHeader         RECORD 0
  312. samplePtr            DS.L 1            ; if NIL then samples are in sampleArea
  313. numChannels            DS.L 1            ; number of channels  mono = 1
  314. sampleRate            DS.L 1            ; sample rate in Apples Fixed point representation
  315. loopStart            DS.L 1            ; loopStart of sound before compression
  316. loopEnd                DS.L 1            ; loopEnd of sound before compression
  317. encode                DS.B 1            ; data structure used ,  stdSH, extSH, or cmpSH
  318. baseFrequency        DS.B 1            ; same meaning as regular SoundHeader
  319. numFrames            DS.L 1            ; length in total number of frames
  320. AIFFSampleRate        DS.B 10            ; IEEE sample rate
  321. markerChunk            DS.L 1            ; sync track
  322. instrumentChunks    DS.L 1
  323. AESRecording        DS.L 1
  324. sampleSize            DS.W 1            ; number of bits in sample
  325. futureUse1            DS.W 1            ; reserved by Apple
  326. futureUse2            DS.L 1            ; reserved by Apple
  327. futureUse3            DS.L 1            ; reserved by Apple
  328. futureUse4            DS.L 1            ; reserved by Apple
  329. sampleArea            EQU     *            ; space for when samples follow directly
  330.                     ENDR
  331.  
  332. ; _______________________________________________________________________
  333. ; Sound Input
  334. ; _______________________________________________________________________
  335.  
  336. siDeviceIsConnected        EQU 1            ; input device is connected and ready for input
  337. siDeviceNotConnected    EQU 0            ; input device is not connected
  338. siDontKnowIfConnected    EQU -1            ; can't tell if input device is connected
  339.  
  340.  
  341. ; Info Selectors for the SPBGetDeviceInfo and SPBSetDeviceInfo calls
  342.  
  343. siDeviceConnected        EQU 'dcon'        ; input device connection status
  344. siAGCOnOff                EQU 'agc '        ; automatic gain control state
  345. siPlayThruOnOff            EQU 'plth'        ; playthrough state
  346. siTwosComplementOnOff    EQU 'twos'        ; two's complement state
  347. siLevelMeterOnOff        EQU 'lmet'        ; level meter state
  348. siRecordingQuality        EQU 'qual'        ; recording quality
  349. siVoxRecordInfo            EQU 'voxr'        ; VOX record parameters
  350. siVoxStopInfo            EQU 'voxs'        ; VOX stop parameters
  351. siNumberChannels        EQU 'chan'        ; current number of channels
  352. siSampleSize            EQU 'ssiz'        ; current sample size
  353. siSampleRate            EQU 'srat'        ; current sample rate
  354. siCompressionType        EQU 'comp'        ; current compression type
  355. siCompressionFactor        EQU 'cmfa'        ; current compression factor
  356. siCompressionHeader        EQU 'cmhd'        ; return compression header
  357. siDeviceName            EQU 'name'        ; input device name
  358. siDeviceIcon            EQU 'icon'        ; input device icon
  359. siDeviceBufferInfo        EQU 'dbin'        ; size of interrupt buffer
  360. siSampleSizeAvailable    EQU 'ssav'        ; sample sizes available
  361. siSampleRateAvailable    EQU 'srav'        ; sample rates available
  362. siCompressionAvailable    EQU 'cmav'        ; compression types available
  363. siChannelAvailable        EQU 'chav'        ; number of channels available
  364. siAsync                    EQU 'asyn'        ; asynchronous capability
  365. siOptionsDialog            EQU 'optd'        ; display options dialog
  366. siContinuous            EQU 'cont'        ; continous recording
  367. siActiveChannels        EQU 'chac'        ; active channels
  368. siActiveLevels            EQU 'lmac'        ; active meter levels
  369. siInputSource            EQU 'sour'        ; input source selector
  370. siInitializeDriver        EQU 'init'        ; reserved for internal use only
  371. siCloseDriver            EQU 'clos'        ; reserved for internal use only
  372. siPauseRecording        EQU 'paus'        ; reserved for internal use only
  373. siUserInterruptProc        EQU 'user'        ; reserved for internal use only
  374.  
  375. ; Quality Selectors for the SndRecord and SndRecordToFile calls
  376.  
  377. siBestQuality            EQU 'best'
  378. siBetterQuality            EQU 'betr'
  379. siGoodQuality            EQU 'good'
  380.  
  381. ; Sound Input Parameter Block (SPB)
  382.  
  383. SInParam            RECORD 0
  384. inRefNum            DS.L 1            ; pointer to Application Reference Block
  385. count                DS.L 1            ; the # of bytes to read
  386. milliseconds        DS.L 1            ; the # of ms of sound to read
  387. bufferLength        DS.L 1            ; length of input buffer
  388. inputBuffer            DS.L 1            ; pointer to input buffer
  389. completionRoutine    DS.L 1            ; procPtr to the user completion routine
  390. interruptRoutine    DS.L 1            ; procPtr to the user interrupt routine
  391. userLong            DS.L 1            ; reserved for user data
  392. error                DS.W 1            ; OSErr will be returned to asynch routines
  393. unused1                DS.L 1            ; reserved for future expansion - must be zero
  394. SInPARAMSize        EQU *            ; size of SInParam
  395.                     ENDR
  396.  
  397.  
  398.     ENDIF    ; ...already included